#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@File ：IndexController.py
@Author ：zqy
@Email : zqingy@work@163.com
@note: 其他接口视图
"""

from flask import request
from flask_restx import Namespace, Resource

from application.logic import IndexLogic
from application.util.ResponseUtil import ResponseUtil

other_ns = Namespace("other", description="其他相关接口")  # 🔥 定义 namespace

other_logic: IndexLogic = IndexLogic


@other_ns.route("/verification_code")
class VerificationCodeResource(Resource):
    logic: IndexLogic = other_logic

    def post(self):
        """发送验证码"""
        IndexLogic.send_verification_code(email=request.args.get("email"))
        return ResponseUtil().success()


@other_ns.route("/", "/index")
class HomeResource(Resource):
    def get(self):
        """主页"""
        return ResponseUtil().success()
